import nci60.data.protein.Protein

def ipiGenes = [:]
Protein.executeQuery('select g.protein.id, g.name from GeneName g').each{line->
    if(!ipiGenes.containsKey(line[0])){ipiGenes.put(line[0], [])}
    ipiGenes[line[0]].add(line[1])
}

def unipGenes = [:]
Protein.executeQuery('select g.protein.protein.id, g.name from UniprotGene g').each{line->
    if(!unipGenes.containsKey(line[0])){unipGenes.put(line[0], [])}
    unipGenes[line[0]].add(line[1])
}
Protein.executeQuery('select g.gene.protein.protein.id, g.name from UniprotGeneSynonym g').each{line->
    if(!unipGenes.containsKey(line[0])){unipGenes.put(line[0], [])}
    unipGenes[line[0]].add(line[1])
}

unipGenes.each{prot,genes->
    if(ipiGenes.containsKey(prot)){
//        println 'uniprot: '+genes+'\tipi: '+ipiGenes[prot]
        if(ipiGenes[prot].size()>1){
            println 'uniprot: '+genes+'\tipi: '+ipiGenes[prot]
        }
    }
}